cmake_minimum_required(VERSION 3.5)
project(test-ji-api)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INSTALL_PREFIX "/usr/local/ev_sdk")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})

if(WITH_ASCENDCL_RUNTIME)
    set(EDGE_INC_PATH $ENV{CANN_INC_PATH})
    set(EDGE_LIB_PATH $ENV{CANN_LIB_PATH})
endif()

# 使用pkg-config查找必要的依赖包
include(opencv)

find_package(PkgConfig REQUIRED)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:/usr/local/ev_sdk/lib:/usr/local/evdeploy/lib/")

add_executable(${PROJECT_NAME} test.cpp Algo.cpp)

if(WITH_ASCENDCL_RUNTIME)
    target_include_directories(${PROJECT_NAME}
        PUBLIC ${EDGE_INC_PATH}
        PUBLIC ${OpenCV_INCLUDE_DIRS}
        PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
        PUBLIC "/usr/local/ev_sdk/include"
	PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../3rd/wkt_parser/include
        )

    target_link_libraries(${PROJECT_NAME}
        ji
        ${OpenCV_LIBS}
        glog
        pthread
        ${EDGE_LIB_PATH}/libascendcl.so
        )
else()
    target_include_directories(${PROJECT_NAME}
    PUBLIC 
        ${OpenCV_INCLUDE_DIRS}
        "/usr/local/ev_sdk/include"
    )

    target_link_libraries(${PROJECT_NAME}
    PRIVATE
        ji
        ${OpenCV_LIBS}
        glog
        pthread
    )
endif()

install(TARGETS ${PROJECT_NAME} DESTINATION bin)
